Skip to content

fastcgi: check for CONTENT_LENGTH when sending requests#6661

Merged
mholt merged 4 commits into
masterfrom
fastcgi-cl-header
Dec 18, 2024
Merged

fastcgi: check for CONTENT_LENGTH when sending requests#6661
mholt merged 4 commits into
masterfrom
fastcgi-cl-header

Conversation

@WeidiDeng

@WeidiDeng WeidiDeng commented Oct 24, 2024

Copy link
Copy Markdown
Member

For #6637, I think previous pr is a bit too ambitious. Requests buffering is hard to do right without considering a multitude of factors. This patch only requires CONTENT_LENGTH to be set for fastcgi requests.

@francislavoie

Copy link
Copy Markdown
Member

So we just throw 411 for any chunked requests? Makes sense that it'll prevent hanging. But long term, shouldn't we have support for streaming chunked requests?

@WeidiDeng

Copy link
Copy Markdown
Member Author

php-fpm doesn't support streaming chunked requests. That's the thing. Golang fastcgi supports streaming chunked requests, but does anyone use that with caddy?

@francislavoie

Copy link
Copy Markdown
Member

https://bz.apache.org/bugzilla/show_bug.cgi?id=57087 looks like Apache fixed their fpm support with buffering

@lutoma

lutoma commented Nov 14, 2024

Copy link
Copy Markdown

Are there any updates on this (or the other patch for the issue)? Seeing these PRs just lying around for a month is pretty discouraging when this is essentially a DoS that seems to affect a lot of people

@mohammed90

Copy link
Copy Markdown
Member

Are there any updates on this (or the other patch for the issue)? Seeing these PRs just lying around for a month is pretty discouraging when this is essentially a DoS that seems to affect a lot of people

The patch only been up for 3 weeks, and it's under review. We've been releasing 2.9.0 betas. You can build Caddy with this patch using xcaddy.

@mholt mholt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Weidi. I like the more conservative approach. Maybe in the future we can figure out how to fix it with buffering to disk, but for now, this will do. :) Really appreciate it!

@mholt mholt added this to the v2.9.0 milestone Dec 10, 2024
Comment thread modules/caddyhttp/reverseproxy/fastcgi/client.go Outdated
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
@mholt mholt enabled auto-merge (squash) December 18, 2024 00:13
@mholt mholt merged commit 6790c0e into master Dec 18, 2024
@mholt mholt deleted the fastcgi-cl-header branch December 18, 2024 00:22
mohammed90 pushed a commit to cedricziel/caddy that referenced this pull request Aug 29, 2025
…6661)

* fastcgi: check for CONTENT_LENGTH when sending requests

* order imports

* use strconv.ParseUint instead of strconv.ParseInt

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

---------

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants